<!DOCTYPE html>
<html>
<head>
    <title>咨询中医</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <meta name="description" content="">

    <link rel="stylesheet" href="/lib/weui.min.css">
    <link rel="stylesheet" href="/css/jquery-weui.css">
    <link rel="stylesheet" href="/css/home.css">
    <link rel="stylesheet" href="/plugins/fontaw/css/font-awesome.css">
    <style>
        body{font-size:0.6rem}

        .doctor_block{width:95%;border:lightgrey solid 1px;margin: auto;margin-top: 0.6rem}
        .link-zone a{color: grey}
        .doctor-info{position: relative;}
        .avatar-b{width: 60px;}
        .avatar-img{border-radius: 50%}
        .info-block{-webkit-box-flex: 1;display: inline-block}
        .max-width{max-width:50%;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
        .weui-cell__bd h4{display: inline-flex;padding-left:0.5rem;font-size: 0.8rem}
        .link-zone i{color: green}
        .weui-form-preview__bd{text-align: left}
        .weui-form-preview__ft{font-size:0.8rem}
        .doctor_block{font-size:0.8rem}
        .weui-form-preview__label{margin-right: 0.2rem}
        .weui-form-preview{margin-bottom: 1rem}

        .shareMask{display: none;width: 100%;height:100%;background-color: rgba(0,0,0,.7);position:absolute;top:0px;text-align: center}
        .shareMask img{width: 100%}
    </style>
<body>

<div class="doctor_block">

</div>

<div class="shareMask">
    <img src="/mod-page/images/wechat/sharetip.png">
    <a href="javascript:;" id="kownBtn" style="font-size:1.2rem"><span> 我知道了</span> </a>
</div>

<script src="/lib/jquery-2.1.4.js"></script>
<script src="/lib/fastclick.js"></script>
<script src="/js/home.js"></script>
<script src="/js/jquery-weui.js"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" charset="utf-8"></script>
<script>
    var patientId = getQueryString("patientId");

    $(".doctor_block").delegate(".consultLink","click",function(){
        var doctorId = $(this).attr("doctorId");
        location.href = "/mod-page/patient/my_doctor_detail.html?patientId="+patientId+"&doctorId="+doctorId;
    });

    $(document).ready(function(){
        loadMyDoctor();
    });

    function loadMyDoctor(){
        $.ajax({
            url:"/patient/loadMyDoctor",
            data:{"patientId":patientId},
            success:function(da){
                $(".doctor_block").html(da);
            }
        });
    }
    $(".doctor_block").delegate(".shareLink","click",function(){
        var doctorId = $(this).attr("doctorId");
        var doctorname = $(this).attr("doctorname");
        var docAvatar = $(this).attr("docAvatar");
        //var vurl  = serverAdd+"/wechat/userauth?doctorId="+doctorId+"&patientId="+patientId;
        //location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+vurl+"&response_type=code&scope=snsapi_base&state=sharedoctor#wechat_redirect";

            wx.onMenuShareAppMessage({
                title: '医师推荐:'+doctorname, // 分享标题
                desc: '杏林名家用户向您推荐了医生，你可以在线发起咨询', // 分享描述
                link: serverAdd+'/mod-page/patient/transform.html?doctorId='+doctorId+"&patientId="+patientId, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                imgUrl: docAvatar, // 分享图标
                type: 'link', // 分享类型,music、video或link，不填默认为link
                dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
                success: function () {
                    $(".shareMask").hide();
                }
            });
        $(".shareMask").show();
    });
    $("#kownBtn").click(function(){
        $(".shareMask").hide();
    });


    initConfig();
    var configOK  = false;
    function initConfig(){
        $.ajax({
            url:"/wechat/jsconfig",
            dataType:"json",
            data:{"vurl":location.href},
            success:function(da){
                wx.config({
                    debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                    appId: da.data.appId, // 必填，公众号的唯一标识
                    timestamp: da.data.timestamp, // 必填，生成签名的时间戳
                    nonceStr: da.data.nonceStr, // 必填，生成签名的随机串
                    signature: da.data.signature,// 必填，签名
                    jsApiList: ["chooseImage","previewImage","uploadImage","onMenuShareAppMessage"] // 必填，需要使用的JS接口列表
                });
            }
        });
    }

</script>
</body>
</html>